﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KL.Store.Core.Domain;
using TN.Data;

namespace KL.Store.Data
{
    public class dbExchangeRate
    {
        #region Insert

        public static void Insert(string Exchange, string ExchangeName, short ExchangeType, DateTime ExchangeDate, decimal Rate, string CreateUser)
        {
            SqlHelper.ExecuteNonQuery(dbParameters.dsnStore, "SPR_ESTORE_ExchangeRate_Insert", new object[] { Exchange, ExchangeName, ExchangeType, ExchangeDate, Rate, CreateUser });
        }

        #endregion

        #region Update

        public static void Update(string Exchange, short ExchangeType, DateTime ExchangeDate, decimal Rate, string UpdateUser)
        {
            SqlHelper.ExecuteNonQuery(dbParameters.dsnStore, "SPR_ESTORE_ExchangeRate_Update", new object[] { Exchange, ExchangeType, ExchangeDate, Rate, UpdateUser });
        }

        #endregion

        #region Delete

        public static void Delete(string Exchange, short ExchangeType, DateTime ExchangeDate)
        {
            SqlHelper.ExecuteNonQuery(dbParameters.dsnStore, "SPR_ESTORE_ExchangeRate_Delete", new object[] { Exchange, ExchangeType, ExchangeDate });
        }

        #endregion

        #region Get

        public static ExchangeRate Get(string Exchange, short ExchangeType, DateTime ExchangeDate)
        {
            IList<ExchangeRate> objectList = new List<ExchangeRate>();
            SqlHelper.FillList(dbParameters.dsnStore, "SPR_ESTORE_ExchangeRate_Get", objectList, new object[] { Exchange, ExchangeType, ExchangeDate });
            return objectList.FirstOrDefault();
        }

        #endregion

        #region GetList

        public static IList<ExchangeRate> GetList(short ExchangeType, DateTime ExchangeDate)
        {
            IList<ExchangeRate> objectList = new List<ExchangeRate>();
            SqlHelper.FillList(dbParameters.dsnStore, "SPR_ESTORE_ExchangeRate_List", objectList, new object[] { ExchangeType, ExchangeDate });

            return objectList;
        }

        #endregion
    }
}
